package com.yx.cloud.product;

import android.content.Context;

import com.iot.common.utils.LogUtils;
import com.yx.cloud.R;
import com.yx.cloud.product.gyro.N5;
import com.yx.cloud.product.laser.yxcloud.U3_FULL;
import com.yx.cloud.product.laser.yxcloud.X3_FULL;
import com.yx.cloud.product.laser.yxcloud.X3_MAX;
import com.yx.cloud.product.laser.yxcloud.X3_PLUS;
import com.yx.cloud.product.laser.yxcloud.X5_MAX;

import java.lang.reflect.Field;
import java.util.List;

public class ProductConfigConstants {
    public static final int PRODUCT_TYPE_GYRO = 0; //陀螺仪扫地机
    public static final int PRODUCT_TYPE_LASER = 1;//激光扫地机
    public static final int PRODUCT_TYPE_VISION = 2;//视觉扫地机


    public static String productId;
    public static String productName;
    public static String productGuide;     //产品指南 url路径
    public static String default_robotName;
    public static String product_type;
    public static String product_desc; //产品类别
    public static String isInxni;

    //配网方式
    public static String net_configure_type_ap; //AP配网 (机器创建wifi等待机器连接)
    public static String net_configure_type_ble;//蓝牙配网
    public static String net_configure_type_lan;//局域网配网（局域网发广播）
    public static String net_configure_type_wifi_p2p;//使用WIFI p2p通道

    //地图管理
    public static String create_map_quickly;//地图界面创建地图按钮
    public static String furniture_edit; //家具编辑按钮
    public static String ddd_2_dd;    //3d 2d 切换按钮
    public static String rotate_map;    //地图旋转按钮
    public static String reset_room;    //恢复默认分区

    //地图
    public static String minCleanAreaSize;
    public static String minForbiddenAreaSize;
    public static String canRotateCleanArea;
    public static String maxAlarmCount;
    public static String powerProtectAreaSize;     //电源保护区域大小   x3s为0.7
    public static String isEditMapNeedPauseRecharge;
    public static String isEditCustomNeedPause;
    public static String showCleanTime;
    public static String showCleanArea;

    //右侧菜单
    public static String hasDustCollectingBarrel;   //集尘桶
    public static String hasConsumablesMaintain;    //耗材维护
    public static String hasMopDry;                 //拖布风干
    public static String hasFirmwareAutoUpdate;//固件自动更新
    public static String customerService;////客服跳转图标
    public static String hasCameraVideo; //摄像头视频
    public static String hasWashMop;                 //是否可以自动清洗拖布
    public static String firmwareUpgradeFail;//固件更新失败后弹框提示
    public static String firmwareUpgradeWay;//固件更新方式
    public static String hasShare;//设备分享
    public static String x5BaseStationHasMultiStyle; //X5基站扫地机图片是否可以切换风格
    public static String carpetSetting_suction;//ZW2X 清扫模式/地毯设置/
    public static String dust_collection_frequency;//集尘频率

    public static String robotIconId;
    public static String robot_Airview; //扫地斜俯视图  /main_x3_pink_icon/main_x3_purple_icon/main_x3_green_icon
    public static String robot_Preview; //扫地机俯视图
    public static String robot_Virtual;
    public static String robot_airview_default;//扫地机默认颜色
    public static String robot_transparent_icon;//扫地机透明图标
    public static String robot_light_images;
    public static String hasMultiStyle;//切换机器图标颜色
    public static String rightSideBrush;//机器右侧边刷
    public static String robot_home_env_2; //配网成功后第二章预览图 x1不同

    public static String cleanSetting_chooseRoom;//选择房间
    public static String cleanSetting_spotClean;//局部清扫
    public static String cleanSetting_edgeClean;//沿墙清扫
    public static String cleanSetting_quickClean;//快速清扫
    public static String cleanSetting_customMode;//定制模式
    public static String cleanSetting_sterilizeMode;//杀菌模式
    public static String cleanSetting_fineRub;//精擦模式
    public static String cleanSetting_noneSuction;//吸力第一个
    public static String cleanSetting_selfCleaningFrequency;//回洗频率
    public static String cleanSetting_carpetPressurization;//地毯增压
    public static String cleanSetting_hasDryMop;//基站水量第一个
    public static String cleanSetting_mopWater;//拖地 布局
    public static String cleanSetting_suction;//吸力布局
    public static String cleanSetting_isConbineWaterTankAndDustBox;
    public static String alarmCleaningFrequency;//清扫次数
    public static String cleanSetting_OnlySuctionShown;//只显示吸力
    public static String cleanSetting_Max_Suction_show;//是否显示超强档吸力
    public static String cleanSetting_ShowOnlyWater;//只显示水量
    public static String moppingTwoGears;//拖地布局 X3（一微）和 X3（自研）拖地状态下显示两个吸力档位：安静、标准档

    //机器人设置界面
    public static String robotSetting_volume;
    public static String robotSetting_break_continue;
    public static String robotSetting_no_disturb;
    public static String robotSetting_silent;
    public static String robotSetting_factoryset;
    public static String robotSetting_light;
    public static String voiceAssistant;//语音助手
    public static String robotSetting_multiMap;//是否有多地图开启开关
    public static String cleaning_mop_settings;//清洗拖布设置
    public static String cleaning_unit_area;//单位面积
    public static String child_lock;//童锁
    public static String cleanRecordHead;//清扫记录界面是否有上面那部分
    public static String dustSuction_time;//集尘吸力/集尘时长

    //机器人固件信息
    public static String hasBaseStationVersion;//基站版本号 只有zw有
    public static String hasUUID;//UUID
    public static String hasSN;//SN
    public static String uploadLog;//上传日志
    public static String robotInfo_wifi;//机器人信息 wifi
    public static String hostMac;//X5基站Mac地址
    public static String hostFirmwareVersion;//X5基站固件版本号
    public static String isP2PChannel;//p2p通道  X3s_p2p X3海外版 PD3I PD4I ZW2X G20
    public static String canUpgradeFirmware;//
    public static String canUpgradeFirmwareChannel;//
    public static String automaticCleanTime;//自动集尘频率次数
    public static String rechargeBaseStation;//基站UI

    //预约
    public static String alarmCleanType;
    public static String alarmMopWater; //pd和陀螺仪没有水量
    public static String alarmSuction;
    public static String custom_suction;     //是否可定制吸力
    public static String custom_water;     //是否可定制水量
    public static String custom_cleanTimes;     //是否可定制清扫次数
    public static String hasMap;//有无地图  陀螺仪rs01/x1/gd01没有地图  rs11有地图 激光有地图
    public static String hasMultiMap;//有无多楼层地图  陀螺仪没有

    //耗材 寿命 单位(s)    值为-1 表示这个产品无此耗材
    public static String consumable_dustStrainer;//尘盒滤网
    public static String consumable_sideBrush;//边刷
    public static String consumable_mainBrush;//主刷
    public static String consumable_mop;//拖布
    public static String consumable_laserSensor;//激光传感器
    public static String consumable_dustBag;//集尘桶 尘袋
    public static String consumable_waterStrainer;//水箱滤网
    public static String backStopControl;
    public static String rechargeStopControl;
    public static String spotCleanStopControl;
    public static String robotIconColorSpecies;

    static {
        Class<ProductConfigConstants> cls = ProductConfigConstants.class;
        Field[] fields = cls.getDeclaredFields();
        try {
            for (Field f : fields) {
                if (f.getType() != String.class) {
                    continue;
                }
                f.setAccessible(true);
//                LogUtils.e("field name: "+ f.getName());
                f.set(null, f.getName());
            }
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    public static String[] deviceList() {
        String[] strProduct = {
                "X3",
                "X3 Max",
                "X3 Plus",
                "N5",
                "U3 Pro"};
        return strProduct;
    }

    /**
     * 蓝牙和AP配网是根据选择的机器型号获取PID
     *
     * @param deviceName
     * @return
     */
    public static String getNetworkDeviceType(String deviceName) {
        LogUtils.i("选择的蓝牙设备 ： " + deviceName);
        String device_type;
        if (deviceName.contains("INXNI-X3-") || "X3".equals(deviceName)) {
            device_type = X3_FULL.PID;
        } else if (deviceName.contains("X3Max") || "X3 Max".equals(deviceName)) {
            device_type = X3_MAX.PID;
        } else if (deviceName.contains("X5Max")) {
            device_type = X5_MAX.PID;
        } else if (deviceName.contains("X3Plus") || "X3 Plus".equals(deviceName)) {
            device_type = X3_PLUS.PID;
        } else if (deviceName.contains("ROBOT-yx") || "N5".equals(deviceName)) {
            device_type = N5.PID;
        } else if (deviceName.contains("INXNI-U3Pro") || "U3 Pro".equals(deviceName)) {
            device_type = U3_FULL.PID;
        } else {
            device_type = "";
        }
        return device_type;
    }

    public static String getNetworkDeviceTypeName(Context context, String deviceType) {
        String device_name;
        if (X3_FULL.PID.equals(deviceType)) {
            device_name = "X3 " + context.getString(R.string.N_SweepAndMopRobot);
        } else if (X3_MAX.PID.equals(deviceType)) {
            device_name = "X3 Max " + context.getString(R.string.N_SweepAndMopRobot);
        } else if (X5_MAX.PID.equals(deviceType)) {
            device_name = "X5 Max " + context.getString(R.string.N_SweepAndMopRobot);
        } else if (X3_PLUS.PID.equals(deviceType)) {
            device_name = "X3 Plus " + context.getString(R.string.N_SweepAndMopRobot);
        } else if (N5.PID.equals(deviceType)) {
            device_name = "N5 " + context.getString(R.string.N_SweepAndMopRobot);
        } else if (U3_FULL.PID.equals(deviceType)) {
            device_name = "U3 Pro " + context.getString(R.string.N_SweepAndMopRobot);
        } else {
            device_name = context.getString(R.string.N_SweepAndMopRobot);
        }
        return device_name;
    }


}
